Skip to content

hase-berlin/pcbGcodeZprobing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

pcbGcodeZprobing

Filter to automatically adjust Z height to a measured height profile of the raw PCB This allows for milling isolation traces on the PCB with a V-shape engraver

Intended use is as a file import filter for LinuxCNC, but also works on command line: just redirect output to a file.

The operational principle is quite simple:

  • the height profile of the raw PCB in the machine is probed (measured)
  • the engraving moves in the file are replaced by moves that follow the measured height profile

To do this, a GCode subroutine for the probing action is prepended to the original GCode. Also a subroutine for the engrave moves is prepended and engrave moves in the input are replaced by calls to this subroutine.

The author uses this filter to process GCode generated by the Fräskontouren-Function found in the Eagle CAD program by Cadsoft. The output of the filter is valid for LinuxCNC, for other CNC controllers some tweaking might be necessary. In particular, for probing the height profile, the G38.2 move is used; other controllers may need another code.

Please note: you must separate engraving/etching moves and drill moves to separate files: this script is for the engraving part, the drills are done separately (via another G-Code-file generated in another run of the G-Code exporter). Eagle by default includes drills and engraves in one file; which is good for machines with automatic tool changers... If you do this frequently, set up a CAM-job to automatically create both G-Code exports. Use a different file extension (like .drill) if you use the script as an input filter in LinuxCNC, this avoids invoking the filter for the drilling moves.

The size of the PCB in the X-Y-plane is autodetected by the script. The copper surface of the PCB is coordinate Z=0, the engrave moves go below that (Z negative, adjustable i nthe source). This is the usual coordinate system for all PCB-GCode generators, the author thinks.

To use the output of the script, your mill must provide a height probe. This probe must provide a signal when the tip of the tool is at Z=0 (copper surface) and no signal when the tip is above that. A very simple implementation has proved to be quite reliable and very precise:

  • mount the raw PCB on the machine so it is electrically isolated (but mechanically screwed down/firmly attached)
  • connect the PCB surface to a free input on the LinuxCNC controller
  • connect the tool in the spindle to ground

For this setup, the HAL wiring is very simple. In your machines HAL file add

net contactprobe => motion.probe-input net contactprobe <= parport.0.pin-13-in-not

(replace 13 by the correct pin number). The pullup resistor in the parport will provide the 3.3 or 5V signal voltage for the "no contact", the tool touching the copper will pull this to ground. Quite simple and in the authors setup sufficiently immune to noise.

All configurable parameters are in the source, near the top of the file.

The script also has some code to remove lines found in the input, replace a line with replacement strings etc. This is configured as regular expressions near the top of the file. The set of expressions in the source are what the author uses to filter Eagle-output to valid LinuxCNC input. Change them as you need and see fit.

Limitations:

  • currently limited to metric units. For imperial, replace the G21 in the file with G20 and try your luck
  • can not read from a pipe: the input is parsed twice; works well on files on disk, not on pipes.
  • no hook for running an optimizer for the moves; use an already-optimised file as input
  • no support for tool-changes: use separate GCode files for contour mill, blow-up and drilling
  • the regex-code for replacing input pattern is not well tested
  • actually: the entire code is not well tested except for the parts shamelessly copied from other peoples work :-)

Much love and many thanks to Poul-Henning Kamp (http://phk.freebsd.dk/CncPcb/index.html) and mattvenn (https://github.com/mattvenn/cad/blob/master/tools/etchZAdjust/Etch_Z_adjust.2.2.py). The entire code is based on mattvenns implementation of Poul-Hennings idea and this work rests on their shoulders.

The implementation by mattvenn is an interactive program with a GUI: that might be the droid you are looking for, so check it out.

again: many thanks to the original authors: my own attempts at milling a PCB on my homebrew machines were extremely frustrating, bordering on expensive (carbide mill bits should grow on trees!) and are finally verging on successful because of your work.

About

Filter to automatically adjust Z height to a measured height profile of the raw PCB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages